using Game.Const;
using Game.Core;
using Game.Main.Model;
using Game.Main.View;
using Game.Manager;
using UnityEngine;

namespace Game.Component
{
	public class GrowPlantItem : BaseItem
	{
		public override void Init(ItemArchiveData data)
		{
			base.Init(data);
		}

		public bool CanGrowUp()
		{
			if (!string.IsNullOrEmpty(base.itemData.changeId))
			{
				return true;
			}
			return false;
		}

		public BaseItem GrowUp()
		{
			if (string.IsNullOrEmpty(base.itemData.changeId))
			{
				return null;
			}
			BaseItem baseItem = parentItem;
			DepthType depthType = depthSystem.depthType;
			AttachType attachType = base.attachType;
			BaseItem baseItem2 = Singleton<Scene>.Instance.ChangeItem(this, base.itemData.changeId);
			if (baseItem != null)
			{
				baseItem.AttachItem(baseItem2, depthType, attachType, true);
			}
			else
			{
				baseItem2.DropDown(base.transform.position, true);
			}
			baseItem2.depthSystem.SortBaseNode();
			Singleton<AudioManager>.Instance.PlaySound("sound_explode");
			Singleton<EffectManager>.Instance.ShowEffect(PathConst.EFFECT + "efc_explode_1", base.transform.position + new Vector3(0f, 0.6f, -1f), 1f);
			Singleton<EffectManager>.Instance.ShowEffect(PathConst.EFFECT + "efc_blink_1", base.transform.position + new Vector3(0f, 0.4f, -1f), 3f);
			return baseItem2;
		}
	}
}
